<?php

namespace mpend\modules\member\controllers;

use Yii;
use mpend\components\Controller;
use mpend\modules\member\models\MemberDataSearch;
use mpend\modules\member\models\MemberApplyForm;
use yii\helpers\Inflector;
use common\models\member\MemberBond;

/**
 * 会员保证金类型
 *
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class BondController extends Controller {

    /**
     * @inheritdoc
     */
    protected function rules() {
        return [
            [
                'allow' => true,
                'roles' => ['@'],
            ],
        ];
    }

    /**
     * @inheritdoc
     */
    protected function verbs() {
        return [
            'status' => ['GET'],
            '*' => ['POST'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function actionStatus($id) {
        $model = MemberBond::find()->active()->andWhere([
            'user_id' => $this->uid,
            'id' => $id,
        ])->one();
        if ($model && $model->isPay) {
            return $model->successMessage;
        }
        return null;
    }

}
